package com.oa.controller.admin;

import com.oa.pojo.Admin;
import com.oa.service.admin.AdminService;
import com.oa.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Autowired
    private AdminService adminService;

    @PostMapping("/login")
    public SysResult adminLogin(@RequestBody Admin admin) {
        admin = adminService.loginAuth(admin);
        if (admin == null){
            return SysResult.fail();
        }
        return SysResult.success(admin);
    }
}
